package mr.ali.webvideo.controller;


import com.github.pagehelper.PageInfo;
import mr.ali.webvideo.Exception.R;
import mr.ali.webvideo.model.CollectionIndexSelection;
import mr.ali.webvideo.service.ICollectionIndexSelectionService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Mr-ali
 * @since 2025-08-16
 */
@RestController
@RequestMapping("/h5/collectionIndexSelection")
public class CollectionIndexSelectionController {
    @Resource
    private ICollectionIndexSelectionService collectionIndexSelectionService;

    @GetMapping("/select")
    public R<PageInfo<CollectionIndexSelection>> list(Integer pageNum, Integer pageSize, Integer type) {
        if (pageNum == null || pageNum == 0) {
            pageNum = 1;
        } else if (pageSize == null || pageNum == 0) {
            pageSize = 4;
        } else if (type == null || pageNum == 0) {
            type = 1;
        }
        PageInfo<CollectionIndexSelection> videoList = collectionIndexSelectionService.findAll(pageNum, pageSize, type);
        return R.ok(videoList);
    }
}
